﻿using Mengsk.ProxyDelivery.Service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Mengsk.ProxyDelivery.App.UI.Sms
{
    /// <summary>
    /// Interaction logic for SmsHistoryModifyWindow.xaml
    /// </summary>
    public partial class SmsHistoryModifyWindow : Window
    {

        public int Id { get; set; }

        public SmsHistoryModifyWindow()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            this.dpStart.Text = DateTime.Now.AddSeconds(-30).ToString("yyyy-MM-dd HH:mm:ss");
            this.dpEnd.Text = DateTime.Now.AddMinutes(5).ToString("yyyy-MM-dd HH:mm:ss");
        }

        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ServiceContainer.GetService<SmsHistoryService>().ModifyTime(this.Id, DateTime.Parse(this.dpStart.Text.Trim()), DateTime.Parse(this.dpEnd.Text.Trim()));
                MessageBox.Show("已修改成功");
                this.DialogResult = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}
